package com.ctgu.rabbitmq.rabbitmq.exchange.directExchange;

import com.ctgu.rabbitmq.entity.UsersEntity;
import lombok.extern.log4j.Log4j2;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @ ClassName DirectExchangeConsumer
 * @ Author Alex2
 * @ Date 2025/8/14 14:59
 **/
@Log4j2
@Component
public class DirectExchangeConsumer {

    private static final String TAG = "Alex";

    // 监听 info 队列
    @RabbitListener(queues = DirectExchangeConfig.QUEUE_INFO)
    public void receiveInfo(UsersEntity usersEntity) {
        log.debug("{} : Queue Info 收到消息 : {}", TAG, usersEntity);
    }

    // 监听 error 队列
    @RabbitListener(queues = DirectExchangeConfig.QUEUE_ERROR)
    public void receiveError(UsersEntity usersEntity) {
        log.debug("{} : Queue Error 收到消息 : {}", TAG, usersEntity);
    }
}
